<!DOCTYPE html>
<!--
 * Small script to change Gawker sites to the blog view
-->
<html>
  <head>
    <script>
      // Called when the tab changes.
      function checkForGawkerUrl(tabId, changeInfo, tab) {
		var domains = ["lifehacker", "gawker", "gizmodo", "kotaku", "deadspin", "jezebel", "io9", "jalopnik"];
		for( var i in domains )
		{
			if (tab.url.indexOf("http://" + domains[i] + ".") == 0) {
				var newUrl = "";
				newUrl += tab.url;
				newUrl = newUrl.replace("http://","http://blog.");
				chrome.tabs.update(tab.id, {url: newUrl});
			}
		}
      };

      // Listen for changes to any tab.
      chrome.tabs.onUpdated.addListener(checkForGawkerUrl);
    </script>
  </head>
</html>
